//
//  MYXcodeView.m
//  meiyinxiang
//
//  Created by 陈李飞 on 2017/11/1.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYXcodeView.h"



@implementation MYXcodeView


-(id)init
{
    self = [super init];
    
    if (self) {
        [self initCreatUI];
    }
    
    return self;
}


-(void)initCreatUI
{
    [self addSubview:self.iconView];
    [self addSubview:self.nameView];
    [self addSubview:self.contentLable];
    [self addSubview:self.codeView];
    [self addSubview:self.imageView];
    [self addSubview:self.titileLabel];
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).with.offset(15);
        make.top.equalTo(self).offset(25);
        make.height.equalTo(@40);
        make.width.equalTo(@40);
    }];
    [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).with.offset(10);
        make.top.equalTo(self.iconView.mas_top).mas_offset(0);
    }];
    [self.contentLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameView);
        make.top.equalTo(self.nameView.mas_bottom).mas_offset(5);
        make.right.equalTo(self).with.offset(-20);
    }];
    
    [self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).with.offset(43);
        make.right.equalTo(self).with.offset(-43);
        make.top.equalTo(self.iconView.mas_bottom).mas_offset(30);
        make.width.equalTo (self.codeView.mas_height);
    }];
    
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.codeView);
        make.centerY.equalTo(self.codeView);
        make.height.equalTo(@70);
        make.width.equalTo(@70);
    }];
    
    
    [self.titileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.bottom.right.equalTo(self);
        make.height.equalTo(@50);
    }];

   
}



#pragma mark - property
- (UIImageView *)iconView
{
    if (_iconView == nil) {
        _iconView = [UIImageView new];
        _iconView.backgroundColor = [UIColor clearColor];
        _iconView.image = [UIImage imageNamed:@"AppIcon"];
        _iconView.clipsToBounds = YES;
        _iconView.layer.cornerRadius = 20;
    }
    return _iconView;
}

- (UILabel *)nameView
{
    if (_nameView == nil) {
        _nameView = [UILabel new];
        _nameView.backgroundColor = [UIColor clearColor];
        _nameView.numberOfLines = 1;
        _nameView.textColor = MYYtitleColor;
        _nameView.font = [UIFont systemFontOfSize:15.0];
        _nameView.text = @"收藏";
    }
    return _nameView;
}
- (UILabel *)contentLable
{
    if (_contentLable == nil) {
        _contentLable = [UILabel new];
        _contentLable.backgroundColor = [UIColor clearColor];
        _contentLable.numberOfLines =0;
        _contentLable.textColor = QFCTielecColor;
        _contentLable.font = MYYFont(15.0);
        _contentLable.text = @"公司的方法哥萨克梵蒂冈的卡萨";
        _contentLable.lineBreakMode = 0;
    }
    return _contentLable;
}
- (UIImageView *)codeView
{
    if (_codeView == nil) {
        _codeView = [UIImageView new];
        _codeView.backgroundColor = [UIColor greenColor];
      //  _codeView.image = [UIImage imageNamed:@"wode_touxiang"];
    }
    return _codeView;
}


- (UIImageView *)imageView
{
    if (_imageView == nil) {
        _imageView = [UIImageView new];
        _imageView.backgroundColor = [UIColor clearColor];
        _imageView.image = [UIImage imageNamed:@"AppIcon"];
        _imageView.clipsToBounds = YES;
        _imageView.layer.cornerRadius = 35;

    }
    return _imageView;
}


- (UILabel *)titileLabel
{
    if (_titileLabel == nil) {
        _titileLabel = [UILabel new];
        _titileLabel.backgroundColor = [UIColor clearColor];
        _titileLabel.numberOfLines = 1;
        _titileLabel.textColor = QFCTielecColor;
        _titileLabel.textAlignment = NSTextAlignmentCenter;
        _titileLabel.font = MYYFont(15.0);
        _titileLabel.text = @"这是我的二维码";
    }
    return _titileLabel;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
